package cn.xxliang.platapp.controller;

import cn.xxliang.platapp.pojo.dto.ProductAreaReDto;
import cn.xxliang.platapp.common.BaseRespWithData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.springframework.validation.annotation.Validated;
import cn.xxliang.platapp.pojo.query.ProductAreaReQuery;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Validated
@RestController
@RequestMapping("/productArea")
@Api(tags = "产品地域限制管理")
public class ProductAreaController {

    @PostMapping("/add")
    @ApiOperation("添加产品地域限制")
    public BaseRespWithData saveProductArea(@RequestBody @Valid ProductAreaReDto dto) {
        return new BaseRespWithData().code(200).msg("操作成功");
    }

    @GetMapping("/get")
    @ApiOperation("查询产品地域限制")
    public BaseRespWithData getProductArea(@RequestParam @NotNull(message = "产品ID不能为空") String productId) {
        return new BaseRespWithData().code(200).msg("查询成功");
    }

    @GetMapping("/delete")
    @ApiOperation("删除产品地域限制")
    public BaseRespWithData deleteProductArea(@RequestParam @NotNull(message = "产品ID不能为空") String productId) {    
        return new BaseRespWithData().code(200).msg("删除成功");
    }

    @PostMapping("/update")
    @ApiOperation("更新产品地域限制")
    public BaseRespWithData updateProductArea(@RequestBody @Valid ProductAreaReDto dto) {
        return new BaseRespWithData().code(200).msg("更新成功");
    }

    @GetMapping("/list")
    @ApiOperation("查询所有产品地域限制列表")
    public BaseRespWithData getProductAreaList(@RequestBody @Valid ProductAreaReQuery query) {
        return new BaseRespWithData().code(200).msg("查询成功");
    }
}